package com.jindi.jacococli.biz.business.client;

import com.jindi.jacococli.biz.utils.ProcessUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.io.File;

import static com.jindi.jacococli.biz.constant.Constant.MVN_COMPILE;


@Service
public class MvnCompileClient {
    public static final Logger LOGGER = LoggerFactory.getLogger(MvnCompileClient.class);

    public boolean compile(String servicePath) {
        String command = String.format(MVN_COMPILE, servicePath);
        LOGGER.info("compile command:{}", command);
        return ProcessUtils.execCommand(command, new File(servicePath));
    }
}
